package com.tiny.shiro;

import javax.sql.DataSource;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

import com.tiny.shiro.entity.User;
import com.tiny.shiro.service.UserService;

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:spring-beans.xml" })
public class ShiroTest2 {

	@Autowired
	protected UserService userService;

	protected JdbcTemplate jdbcTemplate;

	@Autowired
	private void setDataSource(DataSource ds) {
		jdbcTemplate = new JdbcTemplate(ds);
	}

	@Test
	public void register() {
		User u1 = new User("zhu", "123");
		userService.createUser(u1);
	}

}
